home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / hypercar / xcmd / xrulesde.sit / Xrules™ Demo / card_13043.txt < prev    next >
Encoding:
Text File  |  1991-06-24  |  3.7 KB  |  116 lines

  1. -- card: 13043 from stack: in
  2. -- bmap block id: 13081
  3. -- flags: 4000
  4. -- background id: 7992
  5. -- name: 3-Rule Base Overview
  6.  
  7.  
  8. -- part 1 (field)
  9. -- low flags: 01
  10. -- high flags: 0007
  11. -- rect: left=2 top=24 right=311 bottom=510
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 0
  15. -- font id: 22
  16. -- text size: 10
  17. -- style flags: 0
  18. -- line height: 13
  19. -- part name: 
  20.  
  21.  
  22. -- part 3 (button)
  23. -- low flags: 00
  24. -- high flags: 0000
  25. -- rect: left=256 top=314 right=337 bottom=281
  26. -- title width / last selected line: 0
  27. -- icon id / first selected line: 1013 / 1013
  28. -- text alignment: 1
  29. -- font id: 0
  30. -- text size: 12
  31. -- style flags: 0
  32. -- line height: 16
  33. -- part name: Next
  34. ----- HyperTalk script -----
  35. on mouseUp
  36.   go to next card
  37. end mouseUp
  38.  
  39.  
  40.  
  41. -- part contents for card part 1
  42. ----- text -----
  43. The general outline for the rule base is as follows:
  44.  
  45.     global declarations
  46.     fact declarations
  47.     assignments
  48.     rules & daemons
  49.  
  50. We will address each of these topics in the following sections. The complete BNF for the rule base is as follows:
  51.  
  52.   rule_base            :=         [global_declarations]
  53.                                   [fact_declarations]
  54.                                   [assignments]
  55.                                   [ { rule | daemon } ]
  56.  
  57.   global_declarations  :=         GLOBAL  global_id { , global_id}
  58.  
  59.   fact_declarations    :=         FACT  fact_id { , fact_id}
  60.  
  61.   rule                 :=         [RULE rule_id]
  62.                                   IF conditionals 
  63.                                   THEN {assignments | conclusion} 
  64.                                   [ELSE {assignments | conclusion}]
  65.                                   [END IF [END rule_id]]
  66.  
  67.   daemon               :=         [daemon_id]
  68.                                   WHEN conditionals 
  69.                                   THEN assignments 
  70.                                   [ELSE assignments] 
  71.                                   [END IF [END daemon_id]]
  72.  
  73.   conditionals         :=         rel_exp { log_op rel_exp }
  74.  
  75.   rel_exp              :=         [NOT] operand rel_op [NOT] operand |
  76.                                   [NOT] operand | 
  77.                                   [NOT] ( conditionals )
  78.  
  79.   rel_op               :=         > | >= | = | <> | <= | <
  80.  
  81.   log_op               :=         AND | OR
  82.  
  83.   assignments          :=         { PUT operand INTO target }
  84.  
  85.   conclusion           :=         GO [TO [CARD]] card_id
  86.  
  87.   operand              :=         [#]FACT fact_id |
  88.                                   global_id |
  89.                                   real_number |
  90.                                   integer |
  91.                                   boolean |
  92.                                   quoted_string |
  93.                                   simple_string  |
  94.                                   "?" | ? | "*" | * | ""
  95.  
  96.   target                :=        FACT fact_id |
  97.                                   global_id
  98.  
  99.   global_id             :=        simple_string
  100.  
  101.   rule_id               :=        string
  102.  
  103.   daemon_id             :=        string
  104.  
  105.   fact_id               :=        string
  106.  
  107.   card_id               :=        string
  108.  
  109.   string                :=        simple_string | quoted_string
  110.  
  111. Comments in the rule  base are  delineated by preceding  the comment with  "--" just as in HyperTalk.  Everything from the comment indicator to the end of line marker (carriage return) will be considered a comment.  Automatic line wraps are ignored.
  112.  
  113. You should enter your rule base in the card field labeled "Rule Base" on the 
  114. compiler card.  The rule base is limited to only by the size and number of fields used and the amount of memory available to you.  HyperCard fields are limited to 32000 characters and Xrules limits you to 16 fields for the rule base.
  115.  
  116.